(*
CS520 Project
William Blair

Scheduling Interface

*)

staload "generator.sats"
staload "schedule.sats"

implement schedule_run(schedule) = let
  var e : event
  val empty = schedule_next_event(schedule, e)
  in
  if empty then
    schedule_free(schedule)
  else let
    val t = event_timestamp(e)
    val () = schedule_sleep_until(t)
    val () = schedule_run_event(schedule, e)
    in
      schedule_run(schedule)
    end
  end
